package cn.iocoder.yudao.module.promotion.groupon.service.app;

import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.business.basic.service.CreateService;
import cn.iocoder.yudao.framework.business.basic.service.SimpleDeleteService;
import cn.iocoder.yudao.framework.business.basic.service.SimpleDetailService;
import cn.iocoder.yudao.framework.business.basic.service.UpdateService;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.promotion.groupon.pojo.vo.AppGrouponProductRespVO;
import cn.iocoder.yudao.module.promotion.groupon.pojo.vo.GrouponProductSaveDTO;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  这里是文件说明
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/01/13
 */
public interface AppGrouponProductService extends CreateService<GrouponProductSaveDTO>, UpdateService<GrouponProductSaveDTO>, SimpleDeleteService, SimpleDetailService<AppGrouponProductRespVO> {

    /**
     * 根据套餐编号，获得团购产品列表
     *
     * @param packageId 套餐编号
     * @return 团购产品列表
     */
    List<AppGrouponProductRespVO> getListByPackageId(Long packageId);

    /**
     * 根据套餐编号，获得团购产品列表
     *
     * @param packageIds 套餐编号集合
     * @return 团购产品列表
     */
    List<AppGrouponProductRespVO> getListByPackageIds(Set<Long> packageIds);

    /**
     * 根据套餐编号，获得团购产品 Map
     *
     * @param packageIds 套餐编号集合
     * @return 团购产品 Map
     */
    default Map<Long, List<AppGrouponProductRespVO>> getMapByPackageIds(Set<Long> packageIds) {
        List<AppGrouponProductRespVO> list = getListByPackageIds(packageIds);
        if (CollUtil.isEmpty(list)) {
            return new HashMap<>();
        }
        return CollectionUtils.convertMultiMap(list, AppGrouponProductRespVO::getPackageId, productRespVO -> productRespVO);
    }

}
